"""
用户URL配置
定义用户相关的API路由
"""

from django.urls import path
from rest_framework_simplejwt.views import TokenRefreshView
from . import views

app_name = 'users'

urlpatterns = [
    # 认证相关
    path('register/', views.UserRegistrationView.as_view(), name='user_register'),
    path('login/', views.UserLoginView.as_view(), name='user_login'),
    path('logout/', views.logout_view, name='user_logout'),
    path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    path('check-auth/', views.check_auth_view, name='check_auth'),
    path('me/', views.users_me_view, name='users_me'),
    
    # 用户信息管理
    path('profile/', views.UserProfileView.as_view(), name='user_profile'),  # 处理用户信息的获取和更新
    path('profile/detail/', views.UserProfileUpdateView.as_view(), name='user_profile_detail'),
    path('avatar/upload/', views.UserAvatarUploadView.as_view(), name='user_avatar_upload'),
    path('change-password/', views.PasswordChangeView.as_view(), name='change_password'),
    
    # 用户地址管理
    path('addresses/', views.UserAddressViewSet.as_view(), name='user_addresses'),
    path('addresses/<int:pk>/', views.UserAddressDetailView.as_view(), name='user_address_detail'),
    
    # 管理员功能
    path('list/', views.UserListView.as_view(), name='user_list'),
]
